package com.example.gybicycle.common.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * api文档
 */
@Configuration
public class SwaggerConfig  implements WebMvcConfigurer {

    @Bean
    public OpenAPI springShopOpenAPI() {
        return new OpenAPI()
                // 接口文档标题
                .info(new Info().title("广阳岛共享单车API接口文档")
                        // 接口文档简介
                        .description("这是基于Knife4j OpenApi3的接口文档")
                        // 接口文档版本
                        .version("v1.0")
                        // 开发者联系方式
                        .contact(new Contact().name("GrayPigeonHGH").email("2371849349@qq.com")))
                .externalDocs(new ExternalDocumentation()
                        .description("SpringBoot基础框架")
                        .url("http://127.0.0.1:8003"));

     /*   return new OpenAPI()
                .info(new Info().title("文件上传API")
                        .description("这是一个文件上传的API")
                        .version("v0.0.1")
                        .license(new License().name("MIT").url("https://github.com/springdoc/springdoc-openapi-demos/blob/master/springdoc-openapi-demos/src/main/resources/LICENSE")))
                .paths(Paths.paths()
                        .add("/upload", new PathItem()
                                .post(new Operation()
                                        .summary("上传文件")
                                        .operationId("upload")
                                        .requestBody(new RequestBody()
                                                .content(new HashMap<String, MediaType>() {{
                                                    put("multipart/form-data", new MediaType()
                                                            .schema(new Schema<MultipartFile>() {}));
                                                }})
                                                .required(true))
                                        .responses(ApiResponses.builder()
                                                .addApiResponse("200", new ApiResponse().description("文件上传成功"))
                                                .build()))));*/
    }


}
